package zx.x.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.app.entity.ActivityRoomPriceEntity;
import zx.x.modules.app.service.ActivityRoomPriceService;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 房间活动价格表
 *
 * @author x
 * @email x
 * @date 2022-11-02 13:24:57
 */
@RestController
@RequestMapping("app/activityroomprice")
public class ActivityRoomPriceController {
    @Autowired
    private ActivityRoomPriceService activityRoomPriceService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("app:activityroomprice:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = activityRoomPriceService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("app:activityroomprice:info")
    public R info(@PathVariable("id") Integer id){
		ActivityRoomPriceEntity activityRoomPrice = activityRoomPriceService.getById(id);

        return R.ok().put("activityRoomPrice", activityRoomPrice);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("app:activityroomprice:save")
    public R save(@RequestBody ActivityRoomPriceEntity activityRoomPrice){
		activityRoomPriceService.save(activityRoomPrice);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("app:activityroomprice:update")
    public R update(@RequestBody ActivityRoomPriceEntity activityRoomPrice){
		activityRoomPriceService.updateById(activityRoomPrice);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("app:activityroomprice:delete")
    public R delete(@RequestBody Integer[] ids){
		activityRoomPriceService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
